import os
from dataloader import get_paths
from train import main as train_main
from gui import main as gui_main

def main():
    """主程序入口"""
    _, output_dir = get_paths()
    model_path = os.path.join(output_dir, 'lenet5_model.pth')
    
    # 检查模型是否存在
    if not os.path.exists(model_path):
        print("未找到训练好的模型，开始训练...")
        train_main()
    
    # 启动GUI界面
    gui_main()

if __name__ == "__main__":
    main()